
<!DOCTYPE html>
<html>
   <head>
   	  <meta charset="utf-8" />
   	  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
   	  <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>留言信息管理</title>
            <!-- 引入 Bootstrap -->
      <link rel="stylesheet" type="text/css" href="../stylesheets/bootstrap.css"/>
      <script src="../js/jquery.js"></script>
      <script src="../js/bootstrap.min.js"></script>
      
</head>
   <body>
   	<!--导航条-->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
	    <div class="navbar-header">
	        <button type="button" class="navbar-toggle" data-toggle="collapse"data-target="#example-navbar-collapse">
	            <span class="sr-only">切换导航</span>
	            <span class="icon-bar"></span>
	            <span class="icon-bar"></span>
	            <span class="icon-bar"></span>
	        </button>
	        <a class="navbar-brand" href="/">哇槽信息管理系统</a>
	    </div>
	    <div class="collapse navbar-collapse" id="example-navbar-collapse">
	        <ul class="nav navbar-nav">
	            <li class=""><a href="/manage/">用户管理</a></li>
	            <li class=""><a href="theme">吐槽信息管理</a></li>
	            <li class="active"><a href="#">留言管理</a></li>
	        </ul>
	    </div>
    </div>
</nav>
<style type="text/css">
	header{
      		margin-top: 50px;
      		background-color: #EEEEEE;
      	}
  	h1{
  		font-size: 25px;
  		margin-top: 10px;
  	}
	th{
		width: 100px!important;
	}
</style>
 <!--展示留言信息-->
    <div class="container table-responsive" style="margin-top: 80px;">
    	<table class="table table-hover">
    		<thead><h2>留言信息表</h2></thead>
    		<tr>
    			<th class="text-center">留言ID</th>
    			<th class="text-center">创建时间</th>
    			<th class="text-center">留言内容</th>
    			<th class="text-center">图片路径</th>
    			<th class="text-center">主题ID</th>
    			<th class="text-center">用户ID</th>
    			<th class="text-center">回复者ID</th>
    			<th class="text-center">权限</th>
    			<th class="text-center">删除</th>
    		</tr>
    		{{each data as data index}}
    		<tr>
    			<td class="text-center">{{data.id}}</td>
    			<td class="text-center">{{data.time | formatDate}}</td>
    			<td class="text-center" style="min-width:500px;">{{data.content}}</td>
    			<td class="text-center">{{data.img_url}}</td>
    			<td class="text-center">{{data.theme_id}}</td>
    			<td class="text-center">{{data.user_id}}</td>
    			<td class="text-center">{{data.comer_id}}</td>
    			<td class="text-center">{{data.permission}}</td>
    			<td class="text-center">
    				<a data-id="{{data.id}}" class="glyphicon glyphicon-trash liuyan" style="cursor: pointer;"></a>
    			</td>
    		</tr>
    		{{/each}}
    	</table>
    	<!--页面指示器 pagination-->
    	<nav>
    		<ul class="pagination">
    			<!--前一页-->
    			<li {{if page == 1}} class="disabled" {{/if}}>
    				<a {{if page > 1}} href="/answer?page={{page-1}}"{{/if}}><span>&laquo;</span></a>
    			</li>
    			{{each showPages as p i}}
    			<li {{if page == p}} class="active" {{/if}}>
    				<a href="/manage/answer?page={{p}}">{{p}}</a>
    			</li>
    			{{/each}}
    			<!--后一页-->
    			<li {{if page == allPages}} class="disabled" {{/if}}>
    				<a {{if page < allPages}} href="/manage/answer?page={{page+1}}" {{/if}}><span>&raquo;</span></a>
    			</li>
    		</ul>
    	</nav>	
    </div>
</body>
</html>
<script type="text/javascript">
	//删除留言信息
	$('.liuyan').on('click',function(){
		if (confirm('确定删除吗?')) {
			var id= $(this).data("id");
			var path = '../admin/removecomment?comment_id=' + id;
			console.log(path);
			$.get(path,function(resData){
				if (resData.code == 0) {
					location.href = 'answer';
				}
			})
		}
	});
</script>
